﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common;
using System.Collections;

namespace AdminUI.Controllers
{
    public class AdminUserController : BaseController
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Add()
        {
            return PartialView();
        }

        public ActionResult Edit(int ? id)
        {
            if (!id.HasValue)
            {
                return View("error");
            }
            var data = HttpHelper.HttpGet<Result<Param_AdminUser>>(Tools.ApiPath + "api/AdminUser/Find/"+id.Value, "get").Data;
            return PartialView(data);
        }

        public ActionResult Detail(int? id)
        {
            if (!id.HasValue)
            {
                return View("error");
            }
            var data = HttpHelper.HttpGet<Result<Param_AdminUser>>(Tools.ApiPath + "api/AdminUser/Find/" + id.Value, "get");
            if (data.Code != 200)
            {
                return View("error");
            }
            return PartialView(data.Data);
        }

        public ActionResult UpPass(int? id)
        {
            if (!id.HasValue)
            {
                return View("error");
            }
            var data = HttpHelper.HttpGet<Result<Param_AdminUser>>(Tools.ApiPath + "api/AdminUser/Find/" + id.Value, "get");
            if (data.Code != 200)
            {
                return View("error");
            }
            return PartialView(data.Data);
        }
    }
}